<?php

namespace App\Request\auth\Service\Ai;

use App\Repository\Ai\VideoModelRepository;
use App\Request\auth\Service\IService;
use Hyperf\Collection\Collection;


/**
 * 视频模型服务
 */
final class VideoModelService extends IService
{
    public function __construct(
        protected readonly VideoModelRepository $repository,
    )
    {
    }

    public function getList(array $paras, array $filed = ["*"]): Collection
    {
        return $this->repository->list($paras, $filed)->append(['manufacturer_name', 'model_type_text']);
    }

    /**
     * 模型类型
     * @return mixed
     */
    public function getModelTypeList(): mixed
    {
        return $this->repository->getModel()->getModelTypeList();
    }


    /**
     * 处理参数分组
     * @param array $params
     * @return array
     */
    public function handleParams(array $params): array
    {
        $result = [];
        foreach ($params as $param) {
            $result[$param['group']][] = $param;
        }
        foreach ($result as $group => $items) {
            $result[$group] = array_values($items);
        }
        return $result;
    }



}